 package me.freesoft.distributioin;

import java.util.List;

import org.apache.commons.math3.distribution.NormalDistribution;


/**
 * 计算正太分布值 
 * @author ma
 *
 */

public class Distributioin {

	/**
	 *  正太分布计算值，截取小数点后4位，四舍五入
	 * @param p  随机变量值
	 * @param list  历史值
	 * @return 正太分布值
	 */
	public static double distriValue(double p,List list){
		GetAverageandStandardDevition ga = new GetAverageandStandardDevition(list);
		NormalDistribution normalDistributioin = new NormalDistribution(ga.getAverage(),ga.getStandardDevition()); 
		double S1 = normalDistributioin.cumulativeProbability(p);  //正太分布值，计算值为0-1 之间的数
		
		return InsUtil.ins(S1*100) ;
	}
}
